﻿using System;
using System.Threading;
using System.Windows.Forms;
using Presentation;

namespace Application
{
    static class Program
    {
        /// <summary>
        /// 
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() {
            System.Windows.Forms.Application.EnableVisualStyles();
            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);

            System.Windows.Forms.Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            System.Windows.Forms.Application.ThreadException += ProcessUnhandledException;

                var mainScreen = new MainScreen();
                new MainUseCase(mainScreen);
                System.Windows.Forms.Application.Run(mainScreen);
            
        }

        private static void ProcessUnhandledException(object sender, ThreadExceptionEventArgs e) {
            MessageBox.Show(e.Exception.Message, "Ошибка");
        }
    }
}
